package org.lboot.llog.config;

import ch.qos.logback.classic.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class LLogLogConfiguration {
    @Bean
    public ConsoleLogAppender consoleLogAppender() {
        ConsoleLogAppender consoleLogAppender = new ConsoleLogAppender();
        consoleLogAppender.start(); // 启动 Appender
        return consoleLogAppender;
    }

    @Bean
    public Logger rootLogger(ConsoleLogAppender consoleLogAppender) {
        Logger rootLogger = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
        rootLogger.addAppender(consoleLogAppender); // 添加自定义的 Appender
        return rootLogger;
    }
}
